﻿//        Another Demo from Andy L. & MissedMemo.com
// Borrow whatever code seems useful - just don't try to hold
// me responsible for any ill effects. My demos sometimes use
// licensed images which CANNOT legally be copied and reused.

using System.Windows.Controls;
using System.ComponentModel;

using MissedMemo.MeatAndCheeseDisc.OrderEntryDataAccess;


namespace MissedMemo.MeatAndCheeseDisc.OrderEntry
{
    public partial class viewAddEditDessert : UserControl
    {
        public viewAddEditDessert()
        {
            InitializeComponent();

            if( false == DesignerProperties.GetIsInDesignMode( this ) )
            {
                foreach( string strType in LookupMenuItem.GetTypes( "Dessert" ) )
                    comboDessertType.Items.Add( strType );
            }
        }


        // Update sizes, based on type (There's no 'Slice' of Ice Cream...)

        private void comboDessertTypes_SelectionChanged( object sender, SelectionChangedEventArgs e )
        {
            string strType = comboDessertType.SelectedValue as string;

            if( strType != null )
            {
                comboDessertSize.Items.Clear();

                foreach( string strSize in LookupMenuItem.GetSizes( "Dessert", strType ) )
                    comboDessertSize.Items.Add( strSize );

                comboDessertSize.SelectedIndex = 0;
            }
        }
    }
}
